//
//  Configuration.swift
//  XNetwork_Example
//
//  Created by x on 2024/8/9.
//  Copyright © 2024 CocoaPods. All rights reserved.
//

import Moya
import RxSwift

public typealias MoyaError = Moya.MoyaError

public extension Network {
    class Configuration {
        public static var `default`: Configuration = Configuration()
        
        public var online: Observable<Bool> = connectedToInternet()
        
        public var addingHeaders: (TargetType) -> [String: String] = {_ in [:]}
        //请求过程中动态地替换网络请求任务（Task），例如修改请求的参数、请求体或其他相关数据。
        public var replacingTask: (TargetType) -> Task = { $0.task }
        
        public var timeoutInterval: TimeInterval = 30
        
        public var plugins: [PluginType] = [NetworkLoggerPlugin()]
        
//        // 响应之后
//        public var onError: ((Swift.Error) throws -> Void)? = nil
//        
//        public var onSuccess: ((Any) throws -> Void)? = nil
        
        public init() {}
        
    }
}
